<?php

namespace App\Api\Dao;

use App\Models\TongCarousel;
use function Symfony\Component\String\s;

class CarouseDao extends BaseDao
{

    /**
     * 查询构造器
     * @param $data
     * @return \Illuminate\Database\Eloquent\Builder
     */
    function getBuildQuery($data)
    {
        // TODO: Implement getBuildQuery() method.
        $query = TongCarousel::query();
        if(checkIsHasField($data,'id')){
            $query->where('id',$data['id']);
        }
        $query->where('status',1);

        return $query;
    }

    /**
     * 获取所有的轮播图
     * @param array $params
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|void
     */
    public function getCarouse(array $params)
    {
        return $this->getBuildQuery($params)->get();
    }


}
